package com.googlecode.bip.dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import javax.naming.NamingException;
import com.googlecode.bip.dao.utils.Listable;
import com.googlecode.bip.entity.IUserValue;
import com.googlecode.bip.entity.UserValue;

/**
 *
 * @author Claude CHOISNET
 */
public abstract class UserValueDAO
        implements Listable<IUserValue>
{
    private static final long serialVersionUID = 1L;

    /**
     * Build UserValueDAO
     */
    public UserValueDAO()
    {
    }

    @Override //Listable<IQuestion>
    public IUserValue newInstance(final ResultSet rSet )
        throws SQLException
    {
        return new UserValue().set( rSet );
    }

    /**
    *
    * @param idquestion
    * @return
    * @throws SQLException
    * @throws NamingException
   public List<IUserValue> findUserValue( int idquestion )
       throws SQLException, NamingException;
    */

    /**
     *
     * @param iduser
     * @param idquestion
     * @param userdate
     * @return
     * @throws NamingException
     * @throws SQLException
     */
   public abstract IUserValue findUserValue(
           int          iduser,
           int          idquestion,
           Timestamp    userdate
           )
       throws NamingException, SQLException;
   /**
    *
    * @param uservalue
    * @return
    * @throws NamingException
    * @throws SQLException
    */
   public abstract boolean insertUserValue( final IUserValue uservalue )
       throws NamingException, SQLException;

   /**
    *
    * @param uservalue
    * @return
    * @throws NamingException
    * @throws SQLException
    */
   final
   public boolean deleteUserValue(
       final IUserValue uservalue
       )
       throws NamingException, SQLException
   {
       return deleteUserValue(
           uservalue.getIdUser(),
           uservalue.getIdQuestion(),
           uservalue.getUserDate()
           );
   }

   /**
    *
    * @param iduser
    * @param idquestion
    * @param userdate
    * @return
    * @throws NamingException
    * @throws SQLException
    */
   public abstract boolean deleteUserValue(
       final int        iduser,
       final int        idquestion,
       final Timestamp  userdate
       )
       throws NamingException, SQLException;
   /**
    *
    * @param uservalue
    * @return
    * @throws NamingException
    * @throws SQLException
    */
   public abstract boolean updateUserValue( final IUserValue uservalue )
       throws NamingException, SQLException;

}

